home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / telecomm / sticpsrc.lzh / SOURCE.ARC / UDP.H < prev    next >
C/C++ Source or Header  |  1987-12-22  |  1KB  |  41 lines

  1. /* User Datagram Protocol definitions */
  2.  
  3. #define    NUDP    20
  4.  
  5. /* Structure of a UDP protocol header */
  6. struct udp {
  7.     int16 source;    /* Source port */
  8.     int16 dest;    /* Destination port */
  9.     int16 length;    /* Length of header and data */
  10.     int16 checksum;    /* Checksum over pseudo-header, header and data */
  11. };
  12. #define    UDPHDR    8    /* Length of UDP header */
  13.  
  14. /* User Datagram Protocol control block
  15.  * Each entry on the receive queue consists of the
  16.  * remote socket structure, followed by any data
  17.  */
  18. struct udp_cb {
  19.     struct udp_cb *prev;    /* Linked list pointers */
  20.     struct udp_cb *next;
  21.     struct socket socket;    /* Local port accepting datagrams */
  22.     void (*r_upcall)();    /* Function to call when one arrives */
  23.     struct mbuf *rcvq;    /* Queue of pending datagrams */
  24.     int rcvcnt;        /* Count of pending datagrams */
  25. };
  26. extern struct udp_cb *udps[];    /* Hash table for UDP structures */
  27. #define    NULLUDP    (struct udp_cb *)0
  28.  
  29. /* UDP statistics counters */
  30. struct udp_stat {
  31.     int16 rcvd;        /* Packets received */
  32.     int16 sent;        /* Packets sent */
  33.     int16 cksum;        /* Checksum errors */
  34.     int16 unknown;        /* Unknown socket */
  35.     int16 bdcsts;        /* Incoming broadcasts */
  36. };
  37.  
  38. /* UDP primitives */
  39. int open_udp(),recv_udp(),send_udp(),del_udp();
  40. void udp_dump();
  41.